using System;
using System.Collections.Generic;

namespace Shinkansen.Mvc
{
    public class ResourceCollector : IResourceCollector
    {
        private List<string> _js = new List<string> ();
        private List<string> _css = new List<string> ();

        /// <summary>
        /// Registers a JavaScript resource.
        /// </summary>
        /// <param name="path">The path.</param>
        public void AddJs (string path)
        {
            if (string.IsNullOrEmpty (path))
                throw new InvalidOperationException ("The path to this JavaScript resource is not set.");

            _js.Add (path);
        }

        /// <summary>
        /// Registers a CSS resource.
        /// </summary>
        /// <param name="path">The path.</param>
        public void AddCss (string path)
        {
            if (string.IsNullOrEmpty (path))
                throw new InvalidOperationException ("The path to this Css resource is not set.");

            _css.Add (path);
        }

        /// <summary>
        /// Gets the java script.
        /// </summary>
        /// <value>The java script.</value>
        public IEnumerable<string> JavaScript
        {
            get { return _js; }
        }

        /// <summary>
        /// Gets the CSS.
        /// </summary>
        /// <value>The CSS.</value>
        public IEnumerable<string> Css
        {
            get { return _css; }
        }
    }
}